package Exercise1;

import org.junit.Test;

import java.io.*;

public class IOTest2 {
    @Test
    public void test() {
        BufferedReader br=null;
        BufferedWriter bw=null;
        try {
            br = new BufferedReader(new FileReader("hello1.txt"));
            bw = new BufferedWriter(new FileWriter("d:\\test.txt"));
            java.lang.String line = "";
            while ((line=br.readLine())!=null)
            {
                bw.write(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(br!=null)
            {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(bw!=null)
            {
                try {
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
